home *** CD-ROM | disk | FTP | other *** search
-
- query_ident()
-
- Peter Eriksson <pen@lysator.liu.se>
- aka
- Lpd @ NannyMUD
-
-
- Description:
-
- Below follows what changes are needed to implement the function
- query_ident() which returns the token that was retrieved by the
- Identification Server Protocol (see RFC931 or the future new revision
- of a similar protocol). A server for the Ident protocol can be FTP'd from
- 'ftp.lysator.liu.se' in the directory 'pub/ident'. You must be Root to
- install that server. With this function you can (if the remote site
- is running an Ident server) see not only from which host a user is
- connecting, but also his user name.
-
- In addition to the following patches to the LPMUD driver you will need
- the authuser library. It can be FTP'd from 'ftp.lysator.liu.se' in the
- directory 'pub/ident' as 'libauthuser-4.0-p2.tar.Z'.
-
-
- Usage:
-
- string query_ident(void|object);
-
-
- Example:
-
- write("My ident token is: " + query_ident() + ".\n");
-
- write("Player " + ob->short + "'s ident token is: " +
- query_ident(ob) + ".\n");
-
-
- Patchlist:
-
- func_spec.c: Add this in alphabetic order in the list of functions.:
-
- string query_ident(void|object);
-
-
- interpret.c: Add this in the huge switch with all the EFUNs:
-
- #ifdef F_QUERY_IDENT
- CASE(F_QUERY_IDENT);
- {
- extern char *query_ident PROT((struct object *));
- char *tmp;
- struct svalue *arg1;
-
- if (!command_giver || !command_giver->interactive)
- error("query_ident(): illegal caller\n");
-
- arg1 = sapply("query_level_sec", command_giver, 0);
- if (!arg1 || arg1->type != T_NUMBER || arg1->u.number < 22)
- error("query_ident(): illegal caller\n");
-
- if (num_arg == 1 && sp->type != T_OBJECT)
- error("Bad optional argument to query_ident()\n");
-
- tmp = query_ident(num_arg ? sp->u.ob : 0);
- if (num_arg)
- pop_stack();
- if (tmp == 0)
- push_number(0);
- else
- push_string(tmp, STRING_MALLOC);
- break;
- }
- #endif
-
-
- comm1.c: Just before the first function declaration
- "int socket PROT((...));" insert:
-
- #include <authuser.h>
-
- comm1.c: Add this before the function "new_player()":
-
- char *ident_get_identifier(fd)
- int fd;
- {
- extern int auth_fd2();
- extern char *auth_tcpuser3();
-
- unsigned long inlocal;
- unsigned long inremote;
- unsigned short local;
- unsigned short remote;
-
-
- if (auth_fd2(fd, &inlocal, &inremote,
- &local, &remote) == -1)
- return NULL;
-
- return auth_tcpuser2(inlocal, inremote, local, remote, 30);
- }
-
-
- comm1.c: Add this in the function 'new_player()', just after
- the call to 'set_prompt("> ");':
-
- {
- char *userid = ident_get_identifier(new_socket);
-
- master_ob->interactive->ident =
- userid ? make_shared_string(userid) : 0;
- }
-
-
- comm1.c: Add this just before the definition of 'add_ip_entry()':
-
- char *query_ident(ob)
- struct object *ob;
- {
- if (ob == 0)
- ob = command_giver;
-
- if (!ob || ob->interactive == 0)
- return 0;
-
- return ob->interactive->ident;
- }
-
-
- Makefile: Change the "LIBS=" line to include "-lauthuser":
-
- LIBS= -lm -lauthuser # util/gc/gc.a
-
-